"""
A class to exercise the JT core functions.
"""
import JT
import unittest
import itk



class Test(unittest.TestCase):
    def runTest(self):
        """
        Test out the ITK get metric procedure.
        """

        fixedImageName = 'C:/Users/bryan/bryan-code/2D3D/vert1/fluoro/ushortim080-LAT.png'
        movingImageName = 'C:/Users/bryan/bryan-code/trunk/Images/CalibratedDRRImage.png'
        outImageName = 'C:/Users/bryan/bryan-code/trunk/Images/CheckerOut.png'

        fixedImageReader = itk.ImageFileReader.ISS2.New()
        movingImageReader = itk.ImageFileReader.ISS2.New()

        caster = itk.CastImageFilter.ISS2IUC2.New()
        writer = itk.ImageFileWriter.IUC2.New()

        checker = itk.CheckerBoardImageFilter.ISS2.New()
        checker.SetCheckerPattern((12,12))


        fixedImageReader.SetFileName(fixedImageName)
        movingImageReader.SetFileName(movingImageName)

        fixedImageReader.Update()
        movingImageReader.Update()

        checker.SetInput1(fixedImageReader.GetOutput())
        checker.SetInput2(movingImageReader.GetOutput())

        caster.SetInput(checker.GetOutput())
        writer.SetInput(caster.GetOutput())
        writer.SetFileName(outImageName)
        writer.Write()




if __name__ == "__main__":
    t=Test()
    t.runTest()